package com.itheima.api;

import com.itheima.mapper.UmsResourceCategoryMapper;
import com.itheima.pojo.UmsResourceCategory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

/**
 * @author 袁鹏
 * @date 2022-10-13-12:31
 */
@DubboService
public class UmsResourceCategoryApiImpl implements UmsResourceCategoryApi{

    @Autowired
    private UmsResourceCategoryMapper umsResourceCategoryMapper;


    /**
     * 添加后台资源分类
     */
    @Override
    public void create(UmsResourceCategory resourceCategory) {
        resourceCategory.setCreateTime(new Date());
        umsResourceCategoryMapper.insert(resourceCategory);
    }


    /**
     * 根据id删除后台资源分类
     */
    @Override
    public void delete(Long id) {
        umsResourceCategoryMapper.deleteById(id);
    }


    /**
     * 查询所有后台资源分类
     */
    @Override
    public List<UmsResourceCategory> list() {
        return umsResourceCategoryMapper.selectList(null);
    }


    /**
     * 修改后台资源分类
     */
    @Override
    public void update(UmsResourceCategory resourceCategory) {
        umsResourceCategoryMapper.updateById(resourceCategory);
    }
}
